﻿using Owin;
using System;
using System.Web.Http;

namespace King.Box.Owin
{
    public class Startup
    {
        private static Startup _instance;

        public Action<IAppBuilder> Configuration(HttpConfiguration config, Action<IAppBuilder, HttpConfiguration> runAction)
        {
            return (IAppBuilder app) =>
            {
                if (config == null)
                    config = new HttpConfiguration();

                runAction?.Invoke(app, config);

                app.UseWebApi(config);
            };
        }
        public static Startup GetInstance()
        {
            if (_instance == null)
                _instance = new Startup();

            return _instance;
        }
    }
}
